package day22.SecondTest;

import java.util.Scanner;

abstract class Animal {
    private String name;
    private String color;

    public Animal(String name, String color) {
        this.name = name;
        this.color = color;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public abstract void introduce();
}

class Cat extends Animal {
    private String eyecolor;

    public Cat(String name, String color, String eyecolor) {
        super(name, color);
        this.eyecolor = eyecolor;
    }

    public String getEyecolor() {
        return eyecolor;
    }

    public void setEyecolor(String eyecolor) {
        this.eyecolor = eyecolor;
    }

    public void catchMouse() {
        System.out.println("catch mouse");
    }

    @Override
    public void introduce() {
        System.out.println("My name is " + getName() + ", my color is " + getColor() + ", my eyecolor is " + eyecolor);
    }
}

class Dog extends Animal {
    private Integer IQ;

    public Dog(String name, String color, Integer IQ) {
        super(name, color);
        this.IQ = IQ;
    }

    public Integer getIQ() {
        return IQ;
    }

    public void setIQ(Integer IQ) {
        this.IQ = IQ;
    }

    public void catchFrisbee() {
        System.out.println("catch frisbee");
    }

    @Override
    public void introduce() {
        System.out.println("My name is " + getName() + ", my color is " + getColor() + ", my IQ is " + IQ);
    }
}
class TestAnimal{
    public static void introduce(Animal a){
        a.introduce();
    }
    public static void action(Animal a){
       if(a instanceof Dog){
           ((Dog) a).catchFrisbee();
       }else {
           ((Cat) a).catchMouse();
       }
    }
}
public class Main3 {
    public static void main(String args[]) {

        Scanner s = new Scanner(System.in);
        int i = s.nextInt();
        Animal a = null;
        if (i == 1) {
            a = new Cat(s.next(), s.next(), s.next());
        } else if (i == 2) {
            a = new Dog(s.next(), s.next(), s.nextInt());
        }
        TestAnimal.introduce(a);
        TestAnimal.action(a);

    }
}
